package com.example.fund.amplitude;

import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.example.fund.info.FundInfo;
import com.example.fund.util.FundUtil;

public abstract class AbstractTimePeriod {
	
	protected IAmplitude iAmplitude;
	
	public abstract List<String> getTimePeriodList(List<String> dateList);
	public abstract Map<String,String> getTimePeriodMap(List<String> dateList);
	
	public List<String> getSHAmplitudeDateList(List<String> dateList,BigDecimal pRate,BigDecimal nRate)
	{
		FundInfo SHInfo = FundUtil.getFundNetValueFromLocalhost("中证500","0000905");
		List<String> amplitudeDateList = new LinkedList<String>();
		if(dateList==null || SHInfo==null || SHInfo.getActualValues().size()==0)
		{
			return amplitudeDateList;
		}
		
		String startDate = "2007-10-16";
		startDate = "1996-01-22";
	//	startDate = "2005-07-18";
		List<String> amplitudeDateList1 = iAmplitude.getAmplitudeDateList(SHInfo, dateList, pRate.doubleValue(), nRate.doubleValue());
		for(int i=0;i<amplitudeDateList1.size();i++)
		{
			String dateStr = amplitudeDateList1.get(i);
			if(dateStr.compareTo(startDate)>=0)
			{
				amplitudeDateList.add(dateStr);
			}
		}
		
		return amplitudeDateList;
	}
}
